package com.hiultra.archive.device.door;

import java.util.Objects;

/**********************************
 *
 *  标签信息
 *
 * Created by tutu on 2023-01-11
 **********************************/
public class TagInfo {
    private String tid;
    private String epc;
    private Long readTime;
    // 天线
    private int anInt;
    public String inner() {
        return isInner() ? "in" : "out";
    }
    public TagInfo(String tid, String epc, long readTime) {
        this.tid = tid;
        this.epc = epc;
        this.readTime = readTime;
    }

    public TagInfo(String tid, String epc, Long readTime, int anInt) {
        this.tid = tid;
        this.epc = epc;
        this.readTime = readTime;
        this.anInt = anInt;
    }

    public String getTid() {
        return tid;
    }

    public void setTid(String tid) {
        this.tid = tid;
    }

    public String getEpc() {
        return epc;
    }

    public void setEpc(String epc) {
        this.epc = epc;
    }

    public Long getReadTime() {
        return readTime;
    }

    public void setReadTime(Long readTime) {
        this.readTime = readTime;
    }

    public int getAnInt() {
        return anInt;
    }

    public void setAnInt(int anInt) {
        this.anInt = anInt;
    }

    public String getKey() {
        return getEpc();
    }

    // 是否是内天线
    public boolean isInner() {
        return getAnInt() == 1 || getAnInt() == 2;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}
        if (o == null || getClass() != o.getClass()){ return false;}
        TagInfo tagInfo = (TagInfo) o;
        return Objects.equals(tid, tagInfo.tid) && Objects.equals(epc, tagInfo.epc);
    }

    @Override
    public int hashCode() {
        return Objects.hash(tid, epc);
    }
}
